<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>编辑模板</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
    <link rel="stylesheet" href="../layui/css/layui.css">
    <link rel="stylesheet" href="../../css/font.css">
    <link rel="stylesheet" href="../../css/xadmin.css">
    <script type="text/javascript" src="../layui/layui.all.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../js/jquery.min.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../js/xadmin.js"></script>
    <script type="text/javascript" src="../../js/commonutil.js"></script>
    <script src="./seal-channel.js" charset="utf-8"></script>
</head>
<body>
<div class="edit-form-class" style="padding-top: 20px;">
    <form class="layui-form" id="updateSealImgForm">
        <div class="layui-form-item">
            <label class="layui-form-label">*企业名称</label>
            <div class="layui-input-block">
                <input type="text" id="sealOrg" name="sealOrg" readonly="readonly" lay-verify="required|sealOrgVerify" style="width: 350px"
                       autocomplete="off" placeholder="" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">*证件类型</label>
            <div class="layui-input-block" style="width: 350px">
                <input type="text" id="identificationType" name="identificationType" style="display:none;" autocomplete="off">
                <input type="text" id="identificationTypeName" name="identificationTypeName" readonly="readonly" lay-verify="required|identificationTypeVerify" style="width: 350px"
                       autocomplete="off" placeholder="" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">*证件号码</label>
            <div class="layui-input-block">
                <input type="text" id="identificationNo" readonly="readonly" name="identificationNo"
                       lay-verify="required|identificationNoVerify" style="width: 350px" autocomplete="off"
                       placeholder="" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">*印章编码</label>
            <div class="layui-input-block">
                <input type="text" id="sealPwd" name="sealPwd" style="display:none;" autocomplete="off">
                <input type="text" id="sealCode" name="sealCode" readonly="readonly"
                       style="width: 350px" autocomplete="off" placeholder="" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">*印章名称</label>
            <div class="layui-input-block">
                <input type="text" id="sealName" name="sealName" readonly="readonly" lay-verify="required|sealNameVerify"
                       style="width: 350px" autocomplete="off" placeholder="" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">*印章关键字</label>
            <div class="layui-input-block">
                <input type="text" id="keyWords" name="keyWords" readonly="readonly" lay-verify="required|keyWordsVerify"
                       style="width: 350px" autocomplete="off" placeholder="不超过四个汉字,例如:_利_通_" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">*印模图片</label>
            <div class="layui-input-block">
                <input type="text" id="imageCode" name="imageCode" style="display:none;" autocomplete="off">
                <span id="fileName" style="color:#999"></span>
                <button type="button" class="layui-btn-primary layui-btn-lg" id="uploadImage">选择上传图片</button>
                </br></br>
                <span style="color:#999">只能上传png格式文件，文件不能超过1M</span>
                <input id='pictureId' name='pictureId' type="text" class="text" maxlength='50' style='display:none;'/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">*印模尺寸</label>
            <div class="layui-input-block">
                <input type="text" id="imageSize" name="imageSize" lay-verify="required|imageSizeVerify" maxlength="12"
                       style="width: 350px" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block" style="padding-left: 50px;padding-top: 20px">
                <div class="layui-btn" lay-submit="" autocomplete="off" lay-filter="submitBtn" id="submitBtn">保存</div>
                <div class="layui-btn layui-btn-primary" id="closeWin">关闭</div>
            </div>
        </div>
    </form>
</div>
</body>

<script>
    jQuery(function () {
        layui.use(['laypage', 'jquery', 'layer', 'table', 'form', 'util', 'upload'], function () {
            let form = layui.form;
            let upload = layui.upload;
            let id = GetUrlParam("id");
            buildEditWin(form,id);
            //文件上传
            let uploadUrl = serverPre + "/manager/scs/v2/sealInfo/upload";
            uploadFile(upload, uploadUrl);
            form.render();
        });
    });

    //提交
    $('#submitBtn').click(function () {
        layui.use(['jquery'], function () {
            let url = serverPre + "/manager/scs/v2/seal/channel/sealInfo/updateSealImg";
            let formData = serializeObject($("#updateSealImgForm"));
            let commitData = JSON.stringify({
                "id": formData.id,
                "sealOrg": formData.sealOrg,
                "pictureId": formData.pictureId,
                "identificationType": formData.identificationType,
                "identificationNo": formData.identificationNo,
                "sealName": formData.sealName,
                "sealCode": formData.sealCode,
                "imageCode": formData.imageCode,
                "sealImageSize": formData.imageSize,
                "sealPwd": formData.sealPwd,
                "keyWords": formData.keyWords
            });
            submitForm(commitData, url);
        })
    });

    //取消
    $("#closeWin").click(function () {
        var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
        parent.layer.close(index);
    });

</script>
</html>
